Hi All, I am trying to write a simple utility to aid update of DOORS tables. I need to loop through all the visible rows within a selected column and set an attribute for each cell in the column. As usual the dxl ref manual is not providing much help. Is there a "for rows in column construct that I can use? Thanks Mark mwilliamson - Thu May 29 18:05:00 EDT 2014 |
Re: DOORS Table Columns There is not a "for rows in column" loop available in the DXL library so you will need to simulate using the available "for row in table" and "for cell in row" loops but using a conditional statement to detect cells that are in a specific column. The code snippet below uses these loops to display a row-column index for each cell, but it has a condition to focus on a specific column ("colOfInterest") where you would insert your specific actions for the cells of that column. The code snippet assumes that at least one cell in a DOORS table is currently selected.
Object tableRow
Object tableCell
int rowref=0
int colref=0
int colOfInterest = 2
for tableRow in table current Object do { //For each row in a table
rowref++
colref=0
for tableCell in row tableRow do { //For each cell in a row
colref++
if (colref == colOfInterest) print "[r" rowref"" "c" colref"]" "\t"
else print "r" rowref"" "c" colref"" "\t"
}
print "\n"
}
|
Re: DOORS Table Columns PRM - Thu May 29 20:57:57 EDT 2014 There is not a "for rows in column" loop available in the DXL library so you will need to simulate using the available "for row in table" and "for cell in row" loops but using a conditional statement to detect cells that are in a specific column. The code snippet below uses these loops to display a row-column index for each cell, but it has a condition to focus on a specific column ("colOfInterest") where you would insert your specific actions for the cells of that column. The code snippet assumes that at least one cell in a DOORS table is currently selected.
Object tableRow
Object tableCell
int rowref=0
int colref=0
int colOfInterest = 2
for tableRow in table current Object do { //For each row in a table
rowref++
colref=0
for tableCell in row tableRow do { //For each cell in a row
colref++
if (colref == colOfInterest) print "[r" rowref"" "c" colref"]" "\t"
else print "r" rowref"" "c" colref"" "\t"
}
print "\n"
}
This example has a dialog and uses the currently selected cell to determine the column. Add your code in where it says // do something...
void doApply(DB db)
tableObject = getTable(cellObject)
break DB dbMain = create(dbExplorer, "Table Column", styleFloating) DBE dbeGo = apply(dbMain, "Table Column", doApply) realize(dbMain) show(dbMain) Sorry about the formatting - couldn't get the code thing to work. IE problem I think. Tony |
Re: DOORS Table Columns PRM - Thu May 29 20:57:57 EDT 2014 There is not a "for rows in column" loop available in the DXL library so you will need to simulate using the available "for row in table" and "for cell in row" loops but using a conditional statement to detect cells that are in a specific column. The code snippet below uses these loops to display a row-column index for each cell, but it has a condition to focus on a specific column ("colOfInterest") where you would insert your specific actions for the cells of that column. The code snippet assumes that at least one cell in a DOORS table is currently selected.
Object tableRow
Object tableCell
int rowref=0
int colref=0
int colOfInterest = 2
for tableRow in table current Object do { //For each row in a table
rowref++
colref=0
for tableCell in row tableRow do { //For each cell in a row
colref++
if (colref == colOfInterest) print "[r" rowref"" "c" colref"]" "\t"
else print "r" rowref"" "c" colref"" "\t"
}
print "\n"
}
Hi Paul,
Many thanks, you are a saviour. As usual I was pretty close and have amended the script to update a specific tablecell attribute.
Thanks
Mark |